/*
 * Toedo
 * Copyright (C) 2009-2010 J. Devauchelle and contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 3 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

package org.toedo.logging;

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.spi.LoggingEvent;
import org.toedo.controllers.LogController;

public class DebugViewAppender extends AppenderSkeleton {

	public DebugViewAppender() {
		super();
	}
	
	protected void append(LoggingEvent arg0) {
		String text = super.getLayout().format(arg0);
		LogController.getInstance().addToLog(text);
	}

	public void close() {
		super.closed = true;		
	}

	public boolean requiresLayout() {
		return true;
	}
}
